package com.itheima.controller;

import com.itheima.dao.BookDao;
import com.itheima.domain.Book;
import com.itheima.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/books")
public class ZouHaoController {

    @Autowired
    private BookService bookService;

    @GetMapping("{id}")
    public String aa(@PathVariable Integer id) {
        Book book = bookService.findById(id);
        System.out.println(book);
        return "hello world";
    }

    public void aa(){
        BookDao book = (BookDao) bookService.findById(3);
        System.out.println(book);
        System.out.println("hello world");
    }
}
